<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>watch监听</title>
		<!-- 1.引入vue框架 -->
		<script src="vue.js"></script>
	</head>

	<body>
		<!-- 2.定义页面 -->
		<div id="app">
			<input type="text" v-model="cityname" />
		</div>
	</body>
	<script>
		// 3.声明vue对象
		var vm = new Vue({
			el: "#app", //根元素
			data: { //定义变量
				cityname: "shanghai"
			},
			methods: {
				//定义方法
			},
			watch: { //对某个内容的监听
				cityname(newName, oldName) {
					console.log(newName, oldName)
				}
			}
		})
	</script>

</html>